package com.foreknow.demo7;

public class B1 extends A1 {
    int x = 2;
    //重写父类的fun方法
    public void fun() {
        System.out.println("这是子类的fun方法");
    }

    public static void main(String[] args) {
        //多态
        A1 a1 = new B1();
        System.out.println(a1.x);
        a1.fun();

    }
}
